package com.example.myskin;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.lib_skin.SkinManager;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setTitleBar(false, "功能主页");
    }

    TextView titleTx;
    ImageView resultImgv;

    public void setTitleBar(boolean isShowFinshBtn, String titleStr) {
        resultImgv = findViewById(R.id.viewTitleBar_result_imgv);
        titleTx = findViewById(R.id.viewTitleBar_title_tv);

        resultImgv.setVisibility(isShowFinshBtn ? View.VISIBLE : View.GONE);
        titleTx.setText(titleStr);

        findViewById(R.id.main_change_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                SkinManager.getInstance().loadSkin("sdcard/skin.apk");
            }
        });
        findViewById(R.id.main_change2_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SkinManager.getInstance().loadSkin("sdcard/skin_xingkai.apk");

            }
        });

        findViewById(R.id.main_restore_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SkinManager.getInstance().loadSkin(null);
            }
        });
    }


}
